﻿#ifndef ANSWERITEM_H
#define ANSWERITEM_H

#include <QString>
#include <QMap>
#include <QVector>
#include <QPair>
#include <QStringList>

//设计原则   数据模型与视图(界面)分开

class answeritem
{
public:

//    answeritem(const answeritem&ai);
//    answeritem();
//    answeritem& operator=(const answeritem&ai);
//    void set_total_score(int score);
//    int get_score(void)const;

    answeritem(const QString Label,QStringList answers);
    ~answeritem();

    unsigned int get_num()const;//只能获取选项数量
    bool add_item(QString item);//增加选项
    QVector<QPair<QString,int>>& get_items ();//取去选项
    QString get_label()const;
    bool is_single_type()const
    {
        return m_signle_type;
    }
    const QStringList& get_ansmers()const
    {
        return m_answers;
    }

private:
     bool valid_item()const;//判断选项是否正确

private:
    QString m_label;     //题目标签

    unsigned int m_num;  //选项数目   选项的数量是跟QVector<QPair<QString,int>> m_items;同步的
    bool m_signle_type; //单选还是多选

    QVector<QPair<QString,int>> m_items;//题目选项  0-没选  1-选了

    QStringList m_answers;  //答案列表  来判断是多选还是单选

    int m_total_score;//总分 多选


};

#endif // ANSWERITEM_H
